<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        input{
           outline: 0;
        }
        #btn{
           width: 100px;
           height: 30px;
           background-color: royalblue;
           border-radius: 8px;
           border: 0;
           outline: 0;
           color: white;
        }
    </style>
</head>
<body>
    <h1>欢迎光临登录七海博客</h1>
    <form action="/dologin" method="post" onsubmit="return submitForm()" id="show">
        <p>
            用户名：<input type="text" name="username" id="username" placeholder="请输入您的用户名" >
        </p>
        <p>
            密码：<input type="password" name="password" id="password" placeholder="请输入您的密码" >
        </p>
        <input type="submit" value="登录" id="btn">
    </form>
</body>
<script>
    function submitForm(){
        let username =document.getElementById('username').value;
        let password = document.getElementById('password').value;
        let usernameReg = /^[a-zA-Z0-9]{6,}$/;
        if(!usernameReg.test(username)){
            return false;
        }
        let pwdReg =/^.{6,}$/;
        if(!pwdReg.test(password)){
            return false;
        }
        // 登录表单
        return true;
    }
    

</script>
</html>